import { Controller, Get, Query } from '@nestjs/common';
import { AppService } from './app.service';

@Controller()
export class AppController {
  constructor(private readonly appService: AppService) { }

  @Get()
  getHello(@Query() query: { accessKey: string, res: string }) {
    console.log('---query---', query);

    const res = 'userid/390092'
    const accessKey = 'DLglgscpBj+LtmC2aOat369eRxzFtuzeE6dWoq9+1pq8zZ5d2D1g9MPUKc0IcXXEk2p2ZW8OTzIlQIjvSAiTVw=='

    const method = 'sha1';
    // const accessKey = 'mjgvkTCYTBF6DguxMmm+aV9EkDp2CYfL5jzRTph5Th6KhU8gqZz/cBivPTA7tfY5';
    // const res = 'userid/130037';
    const et = 3600 * 1000; // 有效时间：1小时
    return this.appService.getToken(method, res, accessKey, et);
  }
}
